<?php
/* @var $this TicketController */
/* @var $model Ticket */


if($model->customerResident!=''){
$this->breadcrumbs=array(
	$model->customerResident->sm_storename=>array('customerResident/view','id'=>$model->customer_resident_id),
	$model->id,	);
	}

else{	
$this->breadcrumbs=array(
	$model->customerBusiness->cust_name=>array('customerBusiness/view','id'=>$model->customer_business_id),
	$model->id,);
	}
	


if ((Yii::app()->user->type==="Admin")) {
$this->menu=array(
        array('label'=>'Manage', 'url'=>array('admin')),
        array('label'=>'List', 'url'=>array('index')),
        array('label'=>'Delete', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
        array('label'=>'Update', 'url'=>array('update', 'id'=>$model->id)),
        array('label'=>'Create', 'url'=>array('create')),
);
}else if((Yii::app()->user->type==="Manager")){
$this->menu=array(
        array('label'=>'Manage', 'url'=>array('admin')),
        array('label'=>'List', 'url'=>array('index')),
        array('label'=>'Update', 'url'=>array('update', 'id'=>$model->id)),
        array('label'=>'Create', 'url'=>array('create')),
        );
}else {
$this->menu=array(
        array('label'=>'Manage', 'url'=>array('admin')),
        array('label'=>'List', 'url'=>array('index')),
        );
        }
?>
<h1 align = left><?php echo $model->ticket_name?><?php echo ','?> <?php echo $model->ticket_descript?></h1>
<h1>View Ticket #<?php echo $model->id; ?></h1>

<?php $this->widget('zii.widgets.CDetailView', array(
	'data'=>$model,
	'attributes'=>array(
		'id',
		'ticket_name',
		'ticket_descript',
		'ticket_service_type',
		'effective_date',
		'demo_duration',
		'recommendation',
		//'employee_id',
		//'customer_business_id',
		//'customer_resident_id',
	),
)); ?>


<?php $en=Ticket::model()->findAll('id = :a', array(':a'=>$model->id));?>
	<?php if (count($en) !== 0){?>
	<br>
	<h2>Employee</h2>
	<?php foreach ($en as $row) { ?>
	
	<?php $this->widget ('zii.widgets.CdetailView', array(
	        'data'=>$row,
	        'attributes'=>array(
			//'employee_telnum',
			  array('label'=>'Employee' , 'value'=>$row->employee->FullNameEmployee),
			array('label'=>'Telephone Number' , 'value'=>$row->employee->employee_telnum),
				
	          
	        ),
	));
	
	?><br>
	<?php }} ?>


	<?php $en=CustomerBusiness::model()->findAll('id = :a', array(':a'=>$model->customer_business_id));?>
	<?php if (count($en) !== 0){?>
	<br>
	<h2>Customer (Corporate)</h2>
	<?php foreach ($en as $row) { ?>
	<?php echo CHtml::link(Yii::app()->request->baseUrl,
	array('customerBusiness/update', 'id'=>$row->id)); ?>
	<?php $this->widget ('zii.widgets.CdetailView', array(
	        'data'=>$row,
	        'attributes'=>array(
			//'employee_telnum',
			  array('label'=>'Industry' , 'value'=>$row->cust_industry),
			array('label'=>'Company Name' , 'value'=>$row->cust_name),
				array('label'=>'Company/Department Head' , 'value'=>$row->cust_head),
	          array('label'=>'Address Number' , 'value'=>$row->cust_addnum),
			  array('label'=>'City' , 'value'=>$row->cust_city),
			  array('label'=>'Country' , 'value'=>$row->cust_country),
			  array('label'=>'Fax Number' , 'value'=>$row->cust_faxnum),
			  array('label'=>'Contact Last Name' , 'value'=>$row->contact_lname),
			  array('label'=>'Contact First Name' , 'value'=>$row->contact_fname),
			  	  array('label'=>'Telephone Number' , 'value'=>$row->contact_telnum),
				  	  array('label'=>'Email ' , 'value'=>$row->contact_email),
					  	  array('label'=>'Contact Name 2' , 'value'=>$row->cust_contact),
						  	  array('label'=>'Telephone Number' , 'value'=>$row->cust_telnum),
	        ),
	));
	?><br>
	<?php }} ?>
	<?php $en=CustomerResident::model()->findAll('id = :a', array(':a'=>$model->customer_resident_id));?>
	<?php if (count($en) !== 0){?>
	<br>

	<h2>Customer (Sm Tenants)</h2>
	<?php foreach ($en as $row) { ?>
	<?php echo CHtml::link(Yii::app()->request->baseUrl,
	array('customerResident/update', 'id'=>$row->id)); ?>
	<?php $this->widget ('zii.widgets.CdetailView', array(
	        'data'=>$row,
	        'attributes'=>array(
			//'employee_telnum',
			  array('label'=>'Store Name' , 'value'=>$row->sm_storename),
			array('label'=>'Store Type' , 'value'=>$row->sm_storetype),
				array('label'=>'Store Manger' , 'value'=>$row->sm_storemanager),
	          array('label'=>'Telephone Number' , 'value'=>$row->sm_telnum),
			  array('label'=>'SM Mall Branch' , 'value'=>$row->sm_mallbranch),
			 			  array('label'=>'Contact Name1' , 'value'=>$row->contact_main),
						   array('label'=>'Address' , 'value'=>$row->contact_address),
						    array('label'=>'Telephone Number' , 'value'=>$row->contact_maintel),
							 array('label'=>'Email' , 'value'=>$row->contact_email), 
							 array('label'=>'Contact Name2' , 'value'=>$row->contact_name),
							  array('label'=>'Telephone Number' , 'value'=>$row->contact_telnum),
	        ),
	));
	
	?><br>
	<?php }} ?>
	
	
	
	
	
	
	
	

